package com.wn.controller;

import com.wn.util.CrawlDataWikiImpl;
import com.wn.util.ResultVO;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.io.IOException;

/**
 * @program: doctor
 * @ClassName SearchController
 * @description:
 * @author: 韩旭
 * @create: 2023-02-15 12:20
 **/
@RestController
@RequestMapping("search")
public class SearchController {

    @Resource
    private CrawlDataWikiImpl crawlDataWiki;

    @PostMapping("{keyWord}")
    public ResultVO searchKeyWord(@PathVariable String keyWord) throws IOException {
//        System.out.println(keyWord);
        String crawlDataData = crawlDataWiki.getCrawlDataData("http://www.a-hospital.com/w/" + keyWord);
        return ResultVO.success("查询成功",crawlDataData);
    }

}